package P4.T07;

public class TriangleException extends Exception {
    private int a, b, c;
    private AngleError errNo;
    public TriangleException(AngleError errNo, int a, int b, int c) {
        this.errNo = errNo;
        this.a = a;
        this.b = b;
        this.c = c;
    }

    @Override
    public String getMessage() {
        String res=null;
        switch (errNo){
            case AngleError.EdgeLenErrorNeg:res=String.format("边长%d,%d,%d中有负数，不能构成三角形",a,b,c);break;
            case AngleError.EdgeLenErrorRule : res=String.format("边长%d,%d,%d不符合两边之和大于第三边，不符合三角形构成规则",a,b,c);break;
        }
        return res;
    }
}
